package com.zlsy.thread.singleton;

import java.util.Objects;

/**
 * @author zhouliang
 * @date 2020/5/8 20:39
 * <p>
 * 懒汉式 -线程安全的 （不推荐使用）
 */
public class Singleton4 {

    private static Singleton4 instance;


    private Singleton4() {
    }

    public synchronized static Singleton4 getInstance() {
        if (Objects.isNull(instance)) {
            instance = new Singleton4();
        }
        return instance;
    }
}
